package org.nokatag.code;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

public class SingleColorBackgroundFactory
implements BackgroundFactory
{

private ColorFactory colorFactory;

public SingleColorBackgroundFactory()
{
    SingleColorFactory scf = new SingleColorFactory(Color.WHITE);
    colorFactory = scf;
}

public SingleColorBackgroundFactory(Color color)
{
    colorFactory = new SingleColorFactory(color);
}

public void setColorFactory(ColorFactory colorFactory)
{
    this.colorFactory = colorFactory;
}

public void fillBackground(BufferedImage dest)
{
    Graphics g = dest.getGraphics();
    g.setColor(colorFactory.getColor(0));
    g.fillRect(0, 0, dest.getWidth(), dest.getHeight());
}
}

